﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Admin/ControlPanel.Master" AutoEventWireup="true"
    CodeBehind="Pictures.aspx.cs" Inherits="intecnologia.Admin.Pictures" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <asp:ScriptManager ID="AjaxScriptManager" runat="server">
    </asp:ScriptManager>
    <br />
    <center>
        <asp:UpdateProgress ID="UpdateProgress" runat="server" AssociatedUpdatePanelID="PicturesUpdatePanel">
            <ProgressTemplate>
                <asp:Image ID="imgAjaxLoader" runat="server" ImageUrl="~/Admin/css/ajax-loader.gif" />
            </ProgressTemplate>
        </asp:UpdateProgress>
        <h2>
            Imágenes</h2>
        <asp:Button ID="btnAddPictures" runat="server" Text="Agregar una imagen" CssClass="boton"
            OnClick="btnAddPictures_Click" />
    </center>
    <br />
    <div class="mid_content" style="padding: 5px">
        <% if (PicturesCount() > 0) %>
        <% { %>
        <asp:UpdatePanel ID="PicturesUpdatePanel" runat="server">
            <ContentTemplate>
                <center>
                    <asp:DataList runat="server" ID="picturesDataList" RepeatColumns="6" AlternatingItemStyle-BackColor="#e4e4e4"
                        DataKeyField="PictureID" RepeatDirection="Horizontal" Width="500" ItemStyle-HorizontalAlign="Center"
                        ItemStyle-VerticalAlign="Middle" CellPadding="1" BorderStyle="Solid" RepeatLayout="Table"
                        BorderWidth="1px" BorderColor="Black" OnItemCommand="picturesDataList_ItemCommand">
                        <ItemTemplate>
                            <table>
                                <tr valign="bottom">
                                    <td valign="bottom">
                                        <a target="_blank" href="<%# "../ViewImage.aspx?img=" + ((BusinessLayer.Model.Entities.Picture)Container.DataItem).PictureID.ToString() %>">
                                             <%# _galleryService.GetImageTag(70, 70, _galleryService.GetImageFromBytes((BusinessLayer.Model.Entities.Picture)Container.DataItem), Request) %> 				                
                                        </a>
                                    </td>
                                </tr>
                                <tr valign="bottom">
                                    <td valign="bottom">
                                        <center>
                                            <asp:Button ID="btnDeleteImage" runat="server" CssClass="boton" Text="Borrar" CommandName="DeleteImage"
                                                UseSubmitBehavior="false" />
                                        </center>
                                        <cc1:ConfirmButtonExtender ConfirmText="Esta seguro que quiere eliminar esta imágen?"
                                            ID="confirmImageDelete" runat="server" TargetControlID="btnDeleteImage">
                                        </cc1:ConfirmButtonExtender>
                                    </td>
                                </tr>
                            </table>
                        </ItemTemplate>
                    </asp:DataList>
                </center>
            </ContentTemplate>
        </asp:UpdatePanel>
    </div>
    <% } %>
    <% else
        { %>
    <center>
        <h3>
            Actualmente no existen imágenes.</h3>
    </center>
    <% } %>
    <br />
</asp:Content>
